package com.vstudy.zx.utils;


import java.util.HashMap;
import java.util.Map;

public class ParamsUtil {
    public static Map<String, String> queryStringToMap(String str) {
        Map<String, String> rs = new HashMap<>();
        if (str == null || str.isEmpty()) {
            return rs;
        }
        String[] params = str.split("&");
        for (String p :
                params) {
            rs.put(p.substring(0, p.indexOf("=")), p.substring(p.indexOf("=") + 1));
        }
        return rs;
    }

    public static void main(String[] args) {
        Map<String, String> rs = ParamsUtil.queryStringToMap("");
        System.out.println(rs);
    }
}
